cmake_minimum_required(VERSION 3.0)
project(common)

#set(CMAKE_BUILD_TYPE "Debug")
set(CMAKE_BUILD_TYPE "Release")

set(TARGET_LIB_NAME common)

if (WIN32)
add_definitions(-DWINDOWS)
else()
add_definitions(-DLINUX)
endif()

add_definitions(-fPIC)
add_definitions(-fvisibility=hidden)#适用于(隐式)动态链接库，避免符号冲突。

set(SRC_FILES 
    ${PROJECT_SOURCE_DIR}/encode/hex.cpp
    ${PROJECT_SOURCE_DIR}/file/basic.cpp
    ${PROJECT_SOURCE_DIR}/log/log.cpp
    ${PROJECT_SOURCE_DIR}/mathe/mathe.cpp
    ${PROJECT_SOURCE_DIR}/net/socket.cpp
    ${PROJECT_SOURCE_DIR}/thread/pool/1.cpp
    ${PROJECT_SOURCE_DIR}/thread/pool/ring_pool.cpp
    ${PROJECT_SOURCE_DIR}/thread/semaphore.cpp
    ${PROJECT_SOURCE_DIR}/thread/queue_s.cpp
    ${PROJECT_SOURCE_DIR}/random.cpp
    ${PROJECT_SOURCE_DIR}/serialize/serialize.cpp
    ${PROJECT_SOURCE_DIR}/string/str_util.cpp
    ${PROJECT_SOURCE_DIR}/misc.cpp
)

set(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin)

set(LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR}/lib)

add_library(${TARGET_LIB_NAME} STATIC ${SRC_FILES})
